<template>
  <div class="u-page u-box u-text-center u-lh-2 u-pt-50">
    <!-- 图标 -->
    <div>
      <u-icon
        :class="info.type == 'success' ? 'u-cl-primary' : 'u-cl-main'"
        :name="info.type == 'success' ? 'checkmark-circle' : 'info-circle'"
        size="100"
      ></u-icon>
    </div>

    <!-- 标题 -->
    <div
      class="u-fz-20 u-font-bold"
      :class="info.type == 'success' ? 'u-cl-primary' : 'u-cl-main'"
    >
      {{ info.title }}
    </div>

    <!-- 提示 -->
    <div class="u-cl-tips u-mt-15 u-mb-15" v-html="info.tips"></div>

    <!-- 按钮 -->
    <div style="bottom: 100rpx;position: fixed;width: 90%;">
      <div style="margin-top: 40rpx;">
        <u-button type="primary" shape="circle" @click="onClick(info.action)">
          {{ info.btnText }}
        </u-button>
      </div>

      <!-- 关闭按钮 -->
      <div style="margin-top: 40rpx;" v-if="!showCloseBtn">
        <u-button type="info" shape="circle" @click="onClick('toWorkingPlatform')">
          关闭
        </u-button>
      </div>
    </div>

  </div>
</template>

<script>
export default {
  data() {
    return {
      info: {},
      showCloseBtn: false, // 关闭按钮(默认显示)
      MainDocUnid: '',// 【主】文档ID
      SubDocUnid: '',// 【子】文档ID
      Subject: '',// 推广名称
      PartnerName: '',// 参与者昵称
      modes: {},
    };
  },

  onLoad(options) {
    let mode =  options.mode;

    // 【主】文档ID
    this.MainDocUnid = options.MainDocUnid;

    // 【子】文档ID
    this.SubDocUnid = options.SubDocUnid;
	
    // 招聘任务发布成功，操作通知
    if(mode == 1){
      this.info = {
        type: "success",
        title: "提交成功！",
        tips: '您的<span style="color:red;">' + options.Subject + '</span>招聘活动已发布，平台已自动分配给所有符合条件的拍档，请耐心等待报名信息！<br/>温馨提示：分享给好友或微信群，让更多小伙伴了解您的招聘活动哦！',
        btnText: "去分享",
        action: "ShareTask",
      }
    }

    // 报名成功，操作通知
    if(mode == 2){
      this.info = {
        type: "success",
        title: "已获得招聘名额！",
        tips: '<span style="color:red;">' +options.Subject+'</span>任务已启动，请您在<span style="color:red;">' + options.EndTime + '</span>前（含当天）在本平台提交简历，审查通过后，客服人员将会联系您进行下一步流程。<br>温馨提示：您可点击下方按钮或移步“工作台”的“工作待办”处提交简历。',
        btnText: "提交简历",
        action: "submitResults",
      }
    }

    // 提交简历，操作通知
    if(mode == 3){
      this.showCloseBtn = true;// 隐藏关闭按钮
      this.info = {
        type: "success",
        title: "提交成功！",
        tips: '恭喜您，成功提交简历，接下来我们会根据您的简历进行匹配判断。下一步的工作，会由系统通知您或者客服联系您洽谈。【非常重要】。',
        btnText: "关闭",
        action: "toWorkingPlatform",
      }
    }


  },

  methods: {
    /**
     * 按钮点击
     */
    onClick(action) {
      switch (action) {
		  
		// 去工作台---关闭按钮
		case "toWorkingPlatform":
		  uni.reLaunch({url:'/pages_tabbar_contact/personal_contact/WorkBench?backto=personalIndex'});
		  break; 
		
		// 去分享
		case "shareTask":
		  this.$u.route('/pages_private_scene2/Recruit3/SignUp?docUnid='+this.MainDocUnid);
		  break;
		  
		// 提交简历
        case "submitResults":
          this.$u.route('/pages_private_scene2/Recruit3/SubmitResults?docUnid='+this.SubDocUnid);
          break;  
        
		default:
          break;
      }
    },
	
  },
};
</script>

<style lang="scss" scoped></style>
